ipfs-api
Components
Name | Documentation | Crate |
---|---|---|
ipfs-api-prelude | ||
ipfs-api-backend-actix | ||
ipfs-api-backend-hyper | ||
ipfs-api (deprecated) |
Rust library for connecting to the IPFS HTTP API using Hyper/Actix.
Usage
Using Hyper
To use the Hyper backend, declare:
[]
= "0.6"
You can specify either with-hyper-rustls
or with-hyper-tls
(mutually exclusive) feature for TLS support.
Using Actix
To use the Actix backend, declare:
[]
= "0.7"
Builder Pattern
With either the Hyper or Actix backend, you can specify the with-builder
feature to enable a builder pattern to use when building requests.
Usage (DEPRECATED)
[]
= "0.17.0"
Feature Flags (DEPRECATED)
You can use actix-web
as a backend instead of hyper
.
[]
= { = "0.17.0", = ["with-actix"], = false }
You also have the option of using rustls
instead of native tls:
[]
= { = "0.17.0", = ["with-hyper-rustls"], = false }
To enable the builder pattern (default) use the with-builder
feature:
[]
= { = "0.17.0", = ["with-hyper-rustls", "with-builder"], = false }
Examples
Writing a file to IPFS
With Hyper
use ;
use Cursor;
async
With Actix
use ;
use Cursor;
async
Reading a file from IPFS
With Hyper
use TryStreamExt;
use ;
use ;
async
With Actix
use TryStreamExt;
use ;
use ;
async
Additional Examples
There are also a bunch of examples included in the project, which I used for testing
For a list of examples, run:
You can run any of the examples with cargo:
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.